#include "../Logs/cl_logs.hpp"
#include "bench.h"
using namespace cl;
void test_log(const std::string &name)
{
    LOG_INFO("%s", "测试开始");
    Logger::ptr logger = getLogger(name);
    // Logger::ptr logger = LoggerManager::getInstance().GetLogger("Async_logger");
    logger->debug("%s", "测试日志");
    logger->info("%s", "测试日志");
    logger->warn("%s", "测试日志");
    logger->error("%s", "测试日志");
    logger->fatal("%s", "测试日志");
    LOG_INFO("%s", "测试完毕");
}

int main()
{
    std::unique_ptr<Logger::Builder> builder(new GlobalLoggerBuilder());
    builder->buildLoggerLevel(LogLevel::value::DEBUG);
    builder->buildLoggerName("Async_logger");
    builder->buildLoggerType(Logger::Type::LOGGER_SYNC);
    builder->buildFormatter("[%c][%f:%l]%m%n");
    builder->buildSink<StdoutSink>();
    builder->buildSink<FileSink>("../logs/async.log");
    builder->buildSink<RollSink>("../logs/roll-async-by-size", 1024 * 1024);
    builder->build();

    test_log("Async_logger");
    return 0;
}